/*
 * LogisticsFooterListItem.java
 * business
 *
 * Created by SunDing on 2016/12/5.
 *
 * Copyright (c) 2016年 yidiandao. All rights reserved.
 */

package com.yidiandao.business.ui.widget.listview.displaylistitem;

import android.content.Context;
import android.text.TextUtils;
import android.view.View;

import com.yidiandao.business.R;
import com.yidiandao.business.data.response.LogisticsResponse;
import com.yidiandao.business.ui.widget.listview.DisplayListItem;
import com.yidiandao.business.ui.widget.listview.viewholder.LogisticsFooterHolder;
import com.yidiandao.business.utils.UIUtils;

/** 物流信息 底部收货信息 */
public class LogisticsFooterListItem
        extends DisplayListItem<LogisticsFooterHolder, LogisticsResponse.DataBean> {

    public LogisticsFooterListItem(LogisticsResponse.DataBean s) {
        super(s);
    }

    @Override
    public void onShow(Context context, LogisticsFooterHolder holder) {
        //售后服务
        holder.mTvServer.setText(data.getServiceInfo());
        //配送信息
        holder.mTvSendInfo.setText(data.getDeliveryInfo());
        //快递单号
        String shippingNumber = data.getShippingNumber();
        holder.mTvConsignee.setVisibility(
                TextUtils.isEmpty(shippingNumber) ? View.GONE : View.VISIBLE);
        holder.mTvConsignee.setText(
                UIUtils.getString(R.string.logistics_consingee, shippingNumber));
        //客服电话
        String servicePhone = data.getServicePhone();
        holder.mTvPhone.setVisibility(TextUtils.isEmpty(servicePhone) ? View.GONE : View.VISIBLE);
        holder.mTvPhone.setText(UIUtils.getString(R.string.logistics_phone, servicePhone));
        //发货地址
        holder.mLlAddress.setVisibility(
                TextUtils.isEmpty(data.getSendAddress()) ? View.GONE : View.VISIBLE);
        holder.mTvAddressSend.setText(data.getSendAddress());
        //收货地址
        holder.mTvAddressGet.setText(data.getReceiveAddress());
    }

    @Override
    public String getDisplayItemTag() {
        return LogisticsFooterListItem.class.getSimpleName();
    }

    @Override
    public Class<LogisticsFooterHolder> getViewHolderClazz() {
        return LogisticsFooterHolder.class;
    }
}
